package cn.wolfcode.luowowo.article.service.impl;

import cn.wolfcode.luowowo.article.domain.StrategyCatalog;
import cn.wolfcode.luowowo.article.mapper.StrategyCatalogMapper;
import cn.wolfcode.luowowo.article.service.IStrategyCatalogService;
import cn.wolfcode.luowowo.common.query.QueryObject;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.apache.dubbo.config.annotation.Service;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

@Service
public class StrategyCatalogServiceImpl implements IStrategyCatalogService {

    @Autowired
    private StrategyCatalogMapper strategyCatalogMapper;

    /**
     * 攻略分类管理的分页
     * @param qo
     * @return
     */
    public PageInfo query(QueryObject qo) {
        PageHelper.startPage(qo.getCurrentPage(), qo.getPageSize());
        List<StrategyCatalog> list = strategyCatalogMapper.selectForList(qo);
        return new PageInfo(list);
    }

    /**
     * 分类的查询操作
     * @return
     */
    public List<StrategyCatalog> list() {
        return strategyCatalogMapper.selectAll();
    }

    /**
     * 查询概况下面的所有攻略
     * @param destId
     * @return
     */
    public List<StrategyCatalog> listByDestId(Long destId) {
        return strategyCatalogMapper.selectByDestId(destId);
    }

}
